package digui.search;

import java.util.Vector;

/**
 * @author cyt
 * @create 2020-05-29 22:14
 */
public class A {
    /**
     * 全排列
     *
     * @param args
     */

    static Vector<Integer> vector = new Vector<>();

    static int N = 0;

    static boolean[] isUsed = new boolean[100];

    public static void main(String[] args) {

        N = 3;
        dfs(0);
    }

    static void dfs(int n) {
        if (n >= N) {
            for (Integer integer : vector) {
                System.out.print(integer);
            }
            System.out.println();
            return;
        }
        for (int i = 1; i <= N; i++) {
            if (isUsed[i]) {
                continue;
            }
            vector.add(i);
            isUsed[i] = true;
            dfs(n + 1);
            Integer integer = vector.lastElement();
            vector.remove(integer);
            isUsed[i] = false;
        }

    }

}
